FROM centos
RUN yum install wget -y \
    && rm -f /etc/yum.repos.d/* \
    && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo \
    && yum clean all && yum makecache \
    && mkdir -p /root/php && mkdir -p /usr/local/php \
    && yum install -y \
        gcc \
        libxml2-devel \
        curl curl-devel \
        bison bison-devel \
        zlib-devel \
        libmcrypt-devel \
        mcrypt mhash-devel \
        openssl openssl-devel \
        libcurl-devel \
        bzip2-devel \
        readline-devel \
        libedit-devel \
        sqlite-devel \
        jemalloc jemalloc-devel \
        make \
    && /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
    && echo 'Asia/Shanghai' >/etc/timezone \
    && wget -O /root/php/php.tar.gz http://192.168.200.105/php-5.6.40.tar.gz \
    && cd /root/php \
    && tar -xf php.tar.gz   --strip-components 1 \
    && cd /root/php \
    && ./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc  \
        --enable-fpm \
        --with-mysql=mysqlnd \
        --with-mysqli=mysqlnd \
        --with-pdo-mysql=mysqlnd \
        --with-curl \
        --with-gettext \
        --enable-mbstring \
        --with-iconv \
        --with-openssl \
        --enable-opcache  \
    && make -j \
    && make install \
    && cp /root/php/sapi/fpm/init.d.php-fpm /usr/bin/php_fpm \
    && chmod 777 /usr/bin/php_fpm  \
    && cp /root/php/php.ini-development /usr/local/php/etc/php.ini  \
    && ln -s /usr/local/php/bin/* /usr/local/bin  \
    && ln -s /usr/local/php/sbin/* /usr/local/bin  \
    && rm -rf /root/php \
    && yum clean all
EXPOSE 9000
CMD ["php-fpm", "-y", "/usr/local/php/etc/php-fpm.conf", "-F"]
